<template>
	<view>
		<button type="primary" @click="setValue()">点击</button>
		<button type="primary" @click="getValue()">点击</button>
		
		<text class="iconfont icon-headphones"></text>
		<view class="" v-for="item,index in list" :key="index">
			<view class="">{{item.title}}</view><br/>
		</view>
		<view class="shuju" v-for="item,index in res" :key="index">
			<view class="">{{item.title}}</view><br/>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				login:'yes',
				list:[
					{title:'测试',class:'swiper-item1'},
					{title:'测试2',class:'swiper-item2'},
					{title:'测试3',class:'swiper-item3'},
					{title:'测试4',class:'swiper-item4'}
				],
				res: [
					{title:'测试',class:'swiper-item1'},
					{title:'李四',class:'swiper-item2'},
					{title:'张三',class:'swiper-item3'},
					{title:'玩笑',class:'swiper-item4'}
				],
				index: 0,
			}
		},
		onLoad() {
			// const value = uni.getStorageSync('login');
			// 	if (value != 'yes') {
			// 		uni.switchTab({
			// 			url: '/pages/login/login'
			// 		});
			// 	}
			// console.log(JSON.stringify(this.list))
				console.log(this.list);
		},
		methods: {
			setValue:function(e){
				// uni.setStorage('login'.this.login)
				uni.setStorageSync('Log',this.list)
				console.log(this.list);
				this.res =JSON.parse(JSON.stringify(this.list));
				console.log(this.res);
			},
			getValue:function(e){
				const value = uni.getStorageSync('login');
					if (value) {
						console.log(value);
					}
			}
		}
	}
</script>

<style>
@import "../../common/uni.css";
@import "../../common/icon.css";
</style>
